#include "GlobalLayer.h"

GlobalLayer::GlobalLayer(void)
{
	init();
}


GlobalLayer::~GlobalLayer(void)
{
}

void GlobalLayer::show()
{
	Framework::getSingletonPtr()->topLayer->removeChild(this,false);
	Framework::getSingletonPtr()->topLayer->addChild(this);
}

void GlobalLayer::hide()
{
	Framework::getSingletonPtr()->topLayer->removeChild(this,false);
}

bool GlobalLayer::init()
{
	m_pUserInfo = UserInfo::create();
	m_pMenuMain = MainMenu::create();
	m_pExpandTool = ExpandTool::getSingletonPtr();
	//m_pExpandTool->removeFromParent();
	m_pUserInfo->setPosition(ccp(0, 160));
	m_pMenuMain->setPosition(ccp(-130, -215));
	//m_pExpandTool->setPosition(ccp(-80, -180));
	this->addChild(m_pUserInfo);
	this->addChild(m_pMenuMain);
	return true;
}

void GlobalLayer::showUserInfo( bool visible )
{
	m_pUserInfo->setVisible(visible);
}

void GlobalLayer::showMenuMain( bool visible )
{
	m_pMenuMain->setVisible(visible);
}

void GlobalLayer::showExpandTool( bool visible )
{
	m_pExpandTool->setVisible(visible);
	if(visible)
		m_pExpandTool->setPosition(ccp(-80, -180));
}
